//
//  LeftAboutVC.m
//  Ufan
//
//  Created by yangqingluo on 15/12/16.
//  Copyright © 2015年 yangqingluo. All rights reserved.
//

#import "LeftAboutVC.h"

@interface LeftAboutVC ()

@end

@implementation LeftAboutVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = RGBA(245, 245, 245, 1.0);
    [self setupBarButtonItem];
    
    UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 145, 145)];
    imageView.image = [UIImage imageNamed:@"app_icon"];
    imageView.center = CGPointMake(0.5 * self.view.width, imageView.height + 80);
    [self.view addSubview:imageView];
    
    
    
    
    UILabel *rightLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 40)];
    rightLabel.center = CGPointMake(0.5 * self.view.width, self.view.height - 0.5 * rightLabel.height - STATUS_BAR_HEIGHT);
    rightLabel.textAlignment = NSTextAlignmentCenter;
    rightLabel.numberOfLines = 0;
    rightLabel.font = [UIFont systemFontOfSize:12.0];
    rightLabel.textColor = [UIColor lightGrayColor];
    rightLabel.text = @"Copyright (c) 2015 Ufan. All rights reserved.";
    
    [self.view addSubview:rightLabel];
    
    UILabel *versionLabel = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.view.width, 20)];
    versionLabel.center = CGPointMake(0.5 * self.view.width, rightLabel.top - 0.5 * versionLabel.height);
    versionLabel.textAlignment = NSTextAlignmentCenter;
    versionLabel.font = [UIFont systemFontOfSize:14.0];
    versionLabel.textColor = [UIColor blackColor];
    versionLabel.text = [NSString stringWithFormat:@"V %@",[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]];
    
    [self.view addSubview:versionLabel];
}


- (void)setupBarButtonItem{
    self.title = @"关于我们";
    
    UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 64, 44)];
    [backButton setImage:[UIImage imageNamed:@"nav_back.png"] forState:UIControlStateNormal];
    [backButton setImageEdgeInsets:UIEdgeInsetsMake(12, 0, 12, 48)];
    backButton.tag = 988;
    [backButton addTarget:self action:@selector(goBack) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backButton];
    [self.navigationItem setLeftBarButtonItem:backItem];
}

-(void)goBack{
    [self.navigationController popViewControllerAnimated:YES];
}

@end
